package com.kcwl.carrier.interfaces.facade;

import com.alibaba.fastjson.JSONObject;
import com.kcwl.carrier.application.service.AuditRejectReasonApplicationService;
import com.kcwl.carrier.interfaces.dto.AuditRejectReasonInfoDTO;
import com.kcwl.carrier.interfaces.query.AuditRejectReasonQuery;
import com.kcwl.ddd.infrastructure.api.ResponseMessage;
import com.kcwl.framework.rest.helper.ResponseHelper;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author 刘旭超
 * @date 2022年12月01日 15:28
 * @Description
 */
@Slf4j
@RestController
@Api(tags = "驳回原因接口")
@RequestMapping("/carrier/audit")
public class AuditRejectReasonController {

    @Autowired
    private AuditRejectReasonApplicationService applicationService;

    @PostMapping("/queryRejectReason")
    @ApiOperation(value = "查询驳回原因列表")
    public ResponseMessage queryRejectReason(@RequestBody AuditRejectReasonQuery query) {

        log.info("查询驳回原因入参：" + JSONObject.toJSONString(query));
        List<AuditRejectReasonInfoDTO> result = applicationService.queryRejectReason(query);
        log.info("查询驳回原因出参：" + JSONObject.toJSONString(result));
        return ResponseHelper.success(result);
    }
}
